package com.suray.rgv.son.util;

/**
 * 子车运行方向
 */
public enum RgvSonDirection {
    INVALID(-1, "无效"),
    X_LEFT(1, "X方向左"),
    X_RIGHT(3, "X方向右"),
    Y_LEFT(1, "Y方向左"),
    Y_RIGHT(3, "Y方向右"),
    ;

    int value;
    String des;
    RgvSonDirection(int value, String des) {
        this.value = value;
        this.des = des;
    }

    public static RgvSonDirection parseDirection(int value) {
        for (RgvSonDirection rgvSonDirection : RgvSonDirection.values()) {
            if (rgvSonDirection.value == value) {
                return rgvSonDirection;
            }
        }

        return INVALID;
    }

    public int getValue() {
        return value;
    }

    @Override
    public String toString() {
        return des;
    }
}
